home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / hh_str13.zip / SAMPLE.C < prev    next >
C/C++ Source or Header  |  1993-03-13  |  22KB  |  567 lines

  1.  
  2.  
  3. Please note:
  4.  
  5.     This "SAMPLE.C" file is a concatenation of a few source code files
  6.     from the Hobbit House Software hhstring library source code. It is
  7.     presented as part of the demo package to demonstrate the detailed
  8.     documentation which comes with the source code when you buy the
  9.     commercial version of hhstring.
  10.  
  11.     The documentation portion of the source code files is presented
  12.     in the manual.doc file for the demo version of hhstring. For the
  13.     commercial version, the source code itself will also, at the
  14.     owner's option, be included in the manual.doc file.
  15.  
  16.     Print out this file, or examine it with an on-line file viewer, to
  17.     see the quantity/quality of commenting which comes with the source
  18.     code for hhstring.
  19.  
  20.  
  21.  
  22. /*                       ┌───────────────────────┐            strcenternew
  23. ┌────────────────────────┤ Hobbit House Software ├───────────────────────┐
  24.              └───────────────────────┘
  25.               copyright(c) 1992, 1993
  26.  
  27. function:    strcenternew (STRing CENTER to NEW string)
  28.  
  29. KWIC:          %center a string
  30.  
  31. syntax:     #include "hhstring.h"
  32.         char *strcenternew(char *newstring, char *instring)
  33.  
  34. description:    evens out the blanks around a string so that the non-blank
  35.         text is centered. TABs are treated as non-blank characters,
  36.         so this function is not necessarily useful for strings with
  37.         leading and/or trailing TABs. The result is created in the
  38.         new string with the input string being left untouched.
  39.  
  40. returns:    a pointer to the new string
  41.  
  42. comments:    this function assumes that the input string contains
  43.         whitespace on one or both sides but there is no problem
  44.         if it doesn't. If there is no whitespace at all, this
  45.         function just moves instring to newstring.
  46.  
  47.         The string pointed to by the return value of this function
  48.         is in the calling function's space. The return value is
  49.         provided as a convenience, not a necessity.
  50.  
  51.         Setting newstring = instring will not work with this
  52.         function and overlapping newstring/instring may or may
  53.         not work so if you must overlap, do it cautiously.
  54.  
  55. keywords:    string, center, justify, new
  56.  
  57. key sentence:    centers a string and puts the result in a new string
  58.  
  59. see also:    str< lf | rt >just{new}        strcenter{n}{new}
  60.  
  61.  
  62.  
  63. usage example:    compiled/executed/verified on 12/13/92
  64.  
  65.     char *Astring = "  2 left blanks, 11 right blanks           ";
  66.     char *Bstring = "            12 left blanks,  0 right blanks";
  67.     char Cstring[80];
  68.     char Dstring[80];
  69.     strcenternew(Cstring, Astring);
  70.     strcenternew(Dstring, Bstring);
  71.     printf("\n-->%s<--\n-->%s<--", Cstring, Dstring);
  72.  
  73.     -->       2 left blanks, 11 right blanks      <--
  74.     -->      12 left blanks,  0 right blanks      <--
  75.              ┌───────────────────────┐
  76. └────────────────────────┤ Hobbit House Software ├───────────────────────┘
  77.              └───────────────────────┘            */
  78.  
  79.  
  80. #include "hhstring.h"
  81.  
  82. char *strcenternew(            /* return a pointer to newstring*/
  83.     char *newstring,        /* the new string        */
  84.     char *instring)            /* the string to be centered    */
  85. { char *ptr1;                /* destination pointer        */
  86.   char *ptr2;                /* source pointer        */
  87.   int ii;                /* index            */
  88.   int k1;                /* extra shift on left        */
  89.   int k2;                /* extra shift on right        */
  90.   int nleft;                /* # of blanks on the left    */
  91.   int nright;                /* # of blanks on the right    */
  92.   int ncent;                /* # of blanks needed on the    */
  93.                     /*   left to center text    */
  94.   int correct;                /* correction for ncent "error"    */
  95.   int nshifts;                /* number of shifts needed    */
  96.   int slen;                /* slen = the length of        */
  97.   slen = strlen(instring);        /*   the input string        */
  98.   for (ii = 0; ii < slen; ii++)        /* get nleft = the        */
  99.     if (instring[ii] != ' ')        /*   number of blanks on    */
  100.       break;                /*     the left of the        */
  101.   nleft = ii;                /*     input string        */
  102.   for (ii = 0; ii < slen; ii++)        /* get nright = the        */
  103.     if (instring[slen - ii - 1] != ' ')    /*   number of blanks on    */
  104.       break;                /*     the right of the        */
  105.   nright = ii;                /*     input string        */
  106.   ncent = (nleft + nright) / 2;        /* ncent = evenly divided space    */
  107.  
  108.   /*                                    */
  109.   /* If the left side has more blanks than the right side, then the    */
  110.   /* string needs to be shifted to the left as it is moved into the new    */
  111.   /* string. Otherwise, it needs to be shifted to the right as it is    */
  112.   /* moved into the new string. The number of characters which have to    */
  113.   /* be moved from instring into newstring (calculated below as        */
  114.   /* "nshifts") is the string length (slen) minus the number of blanks    */
  115.   /* on the sides (nleft + nright). Once the body of the string has    */
  116.   /* been moved into newstring, an appropriate portion of newstring    */
  117.   /* must be blanked out on each side. This requires a correction    */
  118.   /* factor to accommodate the fact that ncent may or may not have    */
  119.   /* "thrown away half of a character" due to integer arithmetic        */
  120.   /* roundoff error. This correction factor is the total number of    */
  121.   /* blanks (from both sides) taken modulo 2, and is calculated below    */
  122.   /* as "correct". As can be seen in the code, the correction is    */
  123.   /* applied to the left margin if the shift was to the    right and is    */
  124.   /* applied to the right margin if the shift was to the left.        */
  125.   /*                                    */
  126.   nshifts = slen - (nleft + nright);    /* get number of shifts needed    */
  127.   correct = (nleft + nright) % 2;    /* to correct for ncent "error"    */
  128.   /*    -    -    -    -    -    -    -    -    */
  129.   if (ncent > nleft)            /* if shift right is needed:    */
  130.   { ptr1 = newstring + slen - ncent - 1;/* destination is to the right    */
  131.     ptr2 = instring + slen - nright - 1;/*   of the source        */
  132.     for (ii = 0; ii < nshifts; ii++)    /* move the "text" from        */
  133.       *(ptr1 - ii) = *(ptr2 - ii);    /*   instring to the proper    */
  134.                     /*     place in the new string    */
  135.     k1 = correct;            /* set the margin correction    */
  136.     k2 = 0;                /*   for the left side        */
  137.   }                    /* end if            */
  138.   /*    -    -    -    -    -    -    -    -    */
  139.   else                    /* since shift left is needed:    */
  140.   { ptr1 = newstring + ncent;        /* destination is to the left    */
  141.     ptr2 = instring + nleft;        /*   of the source        */
  142.     for (ii = 0; ii < nshifts; ii++)    /* move the "text" from        */
  143.       *(ptr1 + ii) = *(ptr2 + ii);    /*   instring to the proper    */
  144.                     /*     place in the new string    */
  145.     k1 = 0;                /* set the margin correction    */
  146.     k2 = correct;            /*   for the right side        */
  147.   }                    /* end else            */
  148.   /*    -    -    -    -    -    -    -    -    */
  149.   for (ii = 0; ii < ncent + k1; ii++)    /* create the left margin    */
  150.     newstring[ii] = ' ';        /*   of blanks            */
  151.   for (ii = slen-ncent-k2;              /* create the            */
  152.         ii < slen;ii++)        /*   right margin        */
  153.     newstring[ii] = ' ';        /*     of blanks        */
  154.   newstring[slen] = '\0';        /* terminate the new string    */
  155.   return(newstring);            /* return pointer to new string */
  156. }                    /* end function strcenternew    */
  157.  
  158.  
  159. /*                       ┌───────────────────────┐              isfilename
  160. ┌────────────────────────┤ Hobbit House Software ├───────────────────────┐
  161.              └───────────────────────┘
  162.               copyright(c) 1992, 1993
  163.  
  164. function:    isfilename (IS this a valid FILE NAME) (not a path name)
  165.  
  166. KWIC:          determine the %validity of a DOS %file name (but not a
  167.         DOS path name)
  168.  
  169. syntax:        #include <stddef.h>
  170.         #include "hhstring.h"
  171.         int isfilename(char *filename)
  172.  
  173. description:    examines the filename to see whether or not it is a
  174.         valid DOS file name. Paths are NOT allowed. This merely
  175.         checks for illegal characters or too-long names or
  176.         extents.
  177.  
  178. returns:     0 for valid file name
  179.         -1 if name contains * or ? but is otherwise OK
  180.         -2 if name contains invalid characters
  181.         -3 if name is too long
  182.         -4 if extent is too long
  183.         -5 if name is OK other than a meaningless
  184.             use of '*'
  185.  
  186. comments:    none
  187.  
  188. keywords:    filename
  189.  
  190. key sentence:    examines a DOS file name (NOT a path name) and reports
  191.         on whether or not it is valid and if not, gives some
  192.         information about why not
  193.  
  194. see also:    none
  195.  
  196.  
  197.  
  198. usage example:     compiled/executed/verified on 2/1/93
  199.  
  200.         printf("\n%d", isfilename("12345678.9ab"));
  201.         printf("\n%d", isfilename("*.bak"));
  202.         printf("\n%d", isfilename("123<5>78.9ab"));
  203.         printf("\n%d", isfilename("123456789.ab"));
  204.         printf("\n%d", isfilename("1234567.89ab"));
  205.         printf("\n%d", isfilename("*234*.abc"));
  206.  
  207.         0
  208.         -1
  209.         -2
  210.         -3
  211.         -4
  212.         -5
  213.  
  214.              ┌───────────────────────┐
  215. └────────────────────────┤ Hobbit House Software ├───────────────────────┘
  216.              └───────────────────────┘            */
  217.  
  218.  
  219.  
  220. #include <stddef.h>
  221. #include "hhstring.h"
  222.  
  223. int isfilename(            /* return the results flag        */
  224.     char *filename)        /* file name string to check        */
  225. { char *badchars;        /* pointer to string of invalid chars    */
  226.   char *dotptr;            /* pointer to the '.' in the file name    */
  227.   char *tempp;            /* scratch pointer variable        */
  228.   size_t tempi;         /* scratch integer variable        */
  229.   size_t ii;            /* index                */
  230.   int wildflag = 0;        /* flag for whether or not wild card    */
  231.                 /*   characters are present in the    */
  232.                 /*     file name            */
  233.   size_t len;            /* the length of the file name        */
  234.   /*                                    */
  235.   /* executable code begins                        */
  236.   /*                                    */
  237.   badchars = " =;\t\n\"\\"    /* this is a list of the characters     */
  238.         "/|<>+[],.:";    /*   which should NOT be in file names  */
  239.   len = strlen(filename);        /* get the length of the name    */
  240.   for (ii = 0; ii < len; ii++)        /* if any of the characters    */
  241.     if (filename[ii] < 33 ||        /*   in the file name are    */
  242.       (unsigned char)filename[ii] > 127)/*     outside the acceptable    */
  243.       return(-2);            /*     range, return -2    */
  244.  
  245.  
  246.   if ((dotptr = strchr(filename, '.'))    /* if there is no period in the    */
  247.      == NULL)            /*   file name then:        */
  248.   { tempi = strcspn(filename, badchars);/* if there are any bad        */
  249.     if (tempi != len)            /*   characters, then        */
  250.       return(-2);            /*     return -2        */
  251.     if (len > 8)            /* if the name portion is too    */
  252.       return(-3);            /*   long, return -3        */
  253.   }                    /* end no period in name    */
  254.   else                    /* there is a '.' in the file    */
  255.                     /*   name, so:            */
  256.   { *dotptr = '\0';            /* end the string at the '.'    */
  257.     if (strchr(dotptr+1, '.') != NULL)    /* if there is ANOTHER        */
  258.     { *dotptr = '.';            /*   '.', restore the '.'    */
  259.       return(-2);            /*     and return -2        */
  260.     }                    /*     to show bad char    */
  261.     len = strlen(filename);        /* if the name is too        */
  262.     if (len > 8)            /*   long, then            */
  263.     { *dotptr = '.';            /*     restore the '.' and    */
  264.       return(-3);            /*     return -3        */
  265.     }                    /* end if name too long        */
  266.     ii = strindex(dotptr, filename);    /* get the length of the    */
  267.                     /*   name portion        */
  268.     if (strcspn(filename,        /* if the name portion has    */
  269.         badchars) != ii)    /*   any bad characters,    */
  270.     { *dotptr = '.';            /*     restore the dot        */
  271.       return(-2);            /*     and return -2        */
  272.     }                    /* end if name has bad chars    */
  273.     if (strlen(dotptr+1) > 3)        /* if the extent portion is    */
  274.     { *dotptr = '.';            /*   too long, restore        */
  275.       return(-4);            /*     the dot and        */
  276.     }                    /*     return -4        */
  277.     *dotptr = '.';            /* put the '.' back in the name    */
  278.   }                    /* end else period in name    */
  279.   if (strchr(filename, '?') != NULL)    /* if the file name contains a    */
  280.     wildflag = 1;            /*   '?', then set wildflag    */
  281.   tempp = strchr(filename, '*');    /* check for '*' in name    */
  282.   if (tempp != NULL)            /* if there is one:        */
  283.   { wildflag = 1;            /* set the wildcard flag    */
  284.     if (*(tempp + 1) != '.'        /* if the following character    */
  285.      && *(tempp + 1) != '\0')        /*   is not the '.' or the end    */
  286.       return(-5);            /*     of the string, return -5    */
  287.     else                /* the first '*' was OK, so:    */
  288.     { tempp = strchr(tempp+1, '*');    /* if there is a second        */
  289.       if (tempp != NULL)        /*   '*' in the name and it is    */
  290.     if (*(tempp + 1) != '\0')    /*     not the last character    */
  291.       return(-5);            /*     in the name, then    */
  292.     }                    /*       return -5        */
  293.   }                    /* end if there is a '*'    */
  294.  
  295.  
  296.   if (wildflag)                /* if we got this far with no    */
  297.     return(-1);                /*   error exit, but there was    */
  298.                     /*     a wildcard, return -1    */
  299.   return(0);                /* alles ist gut; flag it happy    */
  300. }                    /* end function isfilename    */
  301.  
  302.  
  303. /*                       ┌───────────────────────┐            strmidsetnew
  304. ┌────────────────────────┤ Hobbit House Software ├───────────────────────┐
  305.              └───────────────────────┘
  306.               copyright(c) 1992, 1993
  307.  
  308. function:    strmidsetnew (STRing MIDdle SET to NEW string)
  309.  
  310. KWIC:          %set the %middle of a string to a given character
  311.  
  312. syntax:     #include "hhstring.h"
  313.         char *strmidsetnew(char *newstring, char *instring,
  314.                     int start, int nchar, char setchar)
  315.  
  316. description:    create newstring equal to instring except that from
  317.         "start" characters beyond the beginning to "start" +
  318.         "nchar" characters beyond the beginning, newstring
  319.         consists of "setchar".
  320.  
  321. returns:    a pointer to newstring
  322.  
  323. comments:    if start+nchar would go beyond the end of instring, the
  324.         entire right side of newstring will consist of setchar,
  325.         but newstring will have the same length as instring. If
  326.         start itself would start beyond the end of the instring,
  327.         then newstring will be identical to instring.
  328.  
  329.         The string pointed to by the return value of this function
  330.         is in the calling function's space. The return value is
  331.         provided as a convenience, not a necessity.
  332.  
  333.         Setting newstring = instring WILL NOT WORK with this
  334.         function and overlapping newstring/instring will not work
  335.         in general although in some special cases it will. Analyse
  336.         the source code if you need more details.
  337.  
  338. keywords:    string, middle, set, new
  339.  
  340. key sentence:    changes a specified number of characters in a string,
  341.         starting at a specified point in the string, to a
  342.         specified set character, and puts the results into a
  343.         new string
  344.  
  345. see also:    str{ lf | mid | rt }set{new}
  346.  
  347.  
  348.  
  349. usage example:    compiled/executed/verified on 2/4/93
  350.  
  351.         char Bstring[80];
  352.         char *Astring = "Name Date Amount Number";
  353.         strmidsetnew(Bstring, Astring, 10, 6, '-');
  354.         printf("%s", Bstring);
  355.  
  356.         Name Date ------ Number
  357.  
  358.              ┌───────────────────────┐
  359. └────────────────────────┤ Hobbit House Software ├───────────────────────┘
  360.              └───────────────────────┘            */
  361.  
  362.  
  363. #include "hhstring.h"
  364.  
  365. char *strmidsetnew(            /* return a pointer to newstring*/
  366.         char *newstring,        /* new string to be created    */
  367.         char *instring,        /* string to be set        */
  368.         int start,            /* where the "middle" starts    */
  369.         int nchar,            /* number of set chars to use    */
  370.         char setchar)        /* the set character        */
  371. { int ii;                /* index            */
  372.   int slen;                /* slen = the length        */
  373.   slen = strlen(instring);        /*   of the input string    */
  374.   if (start > slen)            /* if start is beyond the end    */
  375.   { strcpy(newstring, instring);    /*   of instring, put instring    */
  376.     return(newstring);            /*     into newstring and return*/
  377.   }                    /*     a pointer to newstring    */
  378.   nchar = (start + nchar > slen)    /* limit nchar so that the set    */
  379.     ? slen-start : nchar;        /*   does exceed end of string    */
  380.   for (ii = 0; ii < start; ii++)    /* fill left of newstring    */
  381.     newstring[ii] = instring[ii];    /*   from instring        */
  382.   for (ii = 0; ii < nchar; ii++)    /* set from start to start +    */
  383.     newstring[start + ii] = setchar;    /*   nchar to setchar        */
  384.   for (ii=start+nchar; ii < slen; ii++)    /* fill right of newstring    */
  385.     newstring[ii] = instring[ii];    /*   from instring        */
  386.   newstring[slen] = '\0';        /* put terminator in newstring    */
  387.   return(newstring);            /* return pointer to newstring    */
  388. }                    /* end function strmidsetnew    */
  389.  
  390.  
  391. /*                       ┌───────────────────────┐                strxcatn
  392. ┌────────────────────────┤ Hobbit House Software ├───────────────────────┐
  393.              └───────────────────────┘
  394.               copyright(c) 1992, 1993
  395.  
  396. function:    strxcatn (STRing eXtended conCATenate, N-char limit)
  397.  
  398. KWIC:          %concatenate %multiple strings but limit the %size of the
  399.         result to n characters
  400.  
  401. syntax:     #include <stddef.h>
  402.         #include <stdarg.h>
  403.         #include "hhstring.h"
  404.         char *strxcatn(char *instring, int len, ... )
  405.  
  406.         note: ... is a variable list of string pointers which,
  407.         for this function, must be terminated with a pointer to
  408.         a NULL string. The constant NULL is recommended; see the
  409.         code example below.
  410.  
  411. description:    concatenates a variable number of strings onto the
  412.         input string, up to n characters. If the n chars are
  413.         reached, then a terminating '\0' is placed on the string
  414.         at the nth position.
  415.  
  416. returns:    a pointer to the input string
  417.  
  418. comments:    The input string must have enough memory allocated to
  419.         handle all of the concatenation, else there be dragons.
  420.  
  421. keywords:    string, concatenate, size
  422.  
  423. key sentence:    concatenates multiple strings but limits the result to a
  424.         fixed size
  425.  
  426. see also:    strxcat{n}
  427.  
  428.  
  429.  
  430. usage example:    compiled/executed/verified on 2/25/93
  431.  
  432.         char str1[80] = "";
  433.         char stra[10] = "this, ";
  434.         char strb[10] = "that, ";
  435.         char strc[20] = "and the other";
  436.         strxcatn(str1, 20, stra, strb, strc, NULL);
  437.         printf("\n%s<--", str1);
  438.  
  439.         this, that, and the <--        (note 20-char size limit)
  440.  
  441.              ┌───────────────────────┐
  442. └────────────────────────┤ Hobbit House Software ├───────────────────────┘
  443.              └───────────────────────┘            */
  444.  
  445. #include <stddef.h>
  446. #include <stdarg.h>
  447. #include "hhstring.h"
  448.  
  449. char *strxcatn(                /* return pointer to string    */
  450.     char *instring,            /* string to get it all        */
  451.     int len,            /* how long it can be        */
  452.     ... )                /* variable arg list        */
  453. { va_list va_argslist;            /* declare local arg list    */
  454.   int ii;                /* index            */
  455.   int inlen;                /* length of accumulated string    */
  456.   char *thisarg;            /* declare storage for        */
  457.                     /*   individual arguments    */
  458.   va_start(va_argslist, len);        /* start the va_arg utility    */
  459.   while (NULL !=  (thisarg =        /* as long as there are        */
  460.     va_arg(va_argslist, char*)))    /*   more arguments left:    */
  461.   { if (strlen(instring)        /* if the string won't get    */
  462.     + strlen(thisarg) < (size_t)len)/*   too long, concatenate    */
  463.       strcat(instring, thisarg);    /*     this one            */
  464.     else                /* if the string would get too    */
  465.                     /*   long, then:        */
  466.     { inlen = strlen(instring);        /* get length so far        */
  467.       for (ii = 0; ii < len -        /* put in enough chars        */
  468.         inlen; ii++)        /*   to just fill up the    */
  469.     instring[inlen+ii] =        /*     resulting string to    */
  470.             thisarg[ii];    /*     the allowed length,    */
  471.       instring[inlen + ii] = '\0';    /*       terminate the    */
  472.       break;                /*         string and then    */
  473.     }                    /*           let's get the    */
  474.   }                    /*         hell gone    */
  475.   va_end(va_argslist);            /* terminate va_arg as required    */
  476.   return(instring);            /* return pointer to string    */
  477. }                    /* end function strxcatn    */
  478.  
  479. /*                       ┌───────────────────────┐             fnconv_1to2
  480. ┌────────────────────────┤ Hobbit House Software ├───────────────────────┐
  481.              └───────────────────────┘
  482.               copyright(c) 1992, 1993
  483.  
  484. function:    fnconv_1to2 (File Name CONVersion, type 1 TO type 2)
  485.  
  486. KWIC:          %converts %file name format
  487.  
  488. syntax:        #include "hhstring.h"
  489.         void fnconv_1to2(char *fname);
  490.  
  491. description:    converts fname from a type 1 format to a type 2 format.
  492.         The designation of "type 1" and "type 2" to these two
  493.         "types" is purely arbitrary and has no relationship to
  494.         any naming convention outside this library
  495.  
  496.         file format 1 is "name.ext" with a period and no embedded
  497.                   spaces
  498.         file format 2 is "name    ext", with exactly 12 characters
  499.                   including however many spaces it takes in
  500.                   the middle to pad the name and however many
  501.                   it takes at the end to pad the extent
  502.  
  503.         examples:
  504.             format 1:    "sub1.h"
  505.             format 2:    "sub2     h  "
  506.  
  507. returns:    a pointer to the converted file name
  508.  
  509. comments:    the file name must have enough space reserved to
  510.         accommodate the expanded name under the type 2 format.
  511.  
  512.         Since the file name string is modified in the calling
  513.         program's space, use of this function's return value
  514.         is optional.
  515.  
  516. keywords:    filename, convert
  517.  
  518. key sentence:   converts a file name from the format containing a period
  519.         but no blanks to the one with exactly 12 characters and
  520.         no period
  521.  
  522. see also:    fnconv_2to1
  523.  
  524.  
  525.  
  526. usage example:    compiled/executed/verified on 1/17/93
  527.  
  528.         char *filename = "12345678.123";
  529.         printf("\n-->%s<--", filename);
  530.         strcpy(filename, "sub1.h");
  531.         fnconv_1to2(filename);
  532.         printf("\n-->%s<--", filename);
  533.  
  534.         -->12345678.123<--
  535.         -->sub1     h  <--
  536.  
  537.              ┌───────────────────────┐
  538. └────────────────────────┤ Hobbit House Software ├───────────────────────┘
  539.              └───────────────────────┘            */
  540.  
  541.  
  542. #include "hhstring.h"
  543.  
  544. char *fnconv_1to2(            /* return pointer to file name    */
  545.     char *fname)            /* file name to convert        */
  546. { int length;                /* length of name        */
  547.   int tempi;                /* scratch integer variable    */
  548.   char *tempp;                /* scratch pointer        */
  549.   length = strlen(fname);        /* get the length of the name    */
  550.   tempp = strchr(fname, '.');        /* get the '.' position        */
  551.   if (tempp == NULL)            /* if there is no '.', then    */
  552.     strrtpad(fname, 12-length, ' ');    /*   just pad name to 12 chars    */
  553.   else                    /* there is a '.', so        */
  554.   { tempi = strindex(tempp, fname);    /* get the index of the '.'    */
  555.     if (tempi != 8)            /* if the '.' is not in        */
  556.       strmidpad(fname, tempi,        /*   the 9th position,        */
  557.             8-tempi, ' ');    /*     put it there        */
  558.     fname[8] = ' ';            /* blank out the '.'        */
  559.     tempi = strlen(fname);        /* pad the extent        */
  560.     if (tempi != 12)            /*   as much as necessary    */
  561.       strrtpad(fname, 12-tempi, ' ');    /*     to make it 3 chars    */
  562.   }                    /* end else there is a '.'    */
  563.   return(fname);            /* return pointer to name    */
  564. }                    /* end function fnconv_1to2    */
  565.  
  566.  
  567.